-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full task sync #2191
Full task sync #2191
Conversation
} | ||
} | ||
|
||
func (taskManifestHandler *taskManifestHandler) start() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we split this out into multiple (probably 2) handlers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be done, but they are a part of one operation(they are incomplete without each other), so will prefer to keep them together, thoughts?
Summary
A new capability
full-sync
is added which advertises that Agent can handle this new type of messages.Workflow
When the Agent connects to the ACS , ACS with send a
TaskManifest
type of message. Agent is expected to:Check for staleness: The agent will keep track of the highest timeline number received in both PayloadMessage and TaskManifestMessage. If the timeline number on TaskManifestMessage is lower to the latest known one, the TaskManifestMessage must be discarded.
If the Manifest is not stale, compare the list of tasks running on the instance to the list of RUNNING tasks in the Manifest. Tasks not present in the manifest become candidates to be stopped.
If there are stop candidates, Agent will send a TaskStopVerificationMessage to ACS, containing all the tasks it determines need to stop (stop candidates) with a desired status of STOPPED. ACS will then verify if the STOPPED tasks in the message should be terminated. ACS will reply with TaskStopVerificationAck, containing all the tasks that must be terminated with a desired status STOPPED.
The agent must terminate all tasks listed in TaskStopVerificationAck. Exceptions saying the task being terminated does not exist should be ignored. Tasks in the Manifest but NOT on the instance are simply ignored.
Implementation details
seqNumTaskManifest
is added to Agent struct to keep track of latest timeline number Agent has processed.seqNumTaskManifest
is stored in the state file so that it can be restored when Agent restarts.seqNumTaskManifest
is updated in the state file and Agent struct, on every payload message and TaskManifest message.Testing
New tests cover the changes:yes
Description for the changelog
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.